package com.xc.config;

import com.xc.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xingchen
 * @create 2021/11/4 21:45
 */
@Configuration
@Slf4j
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new LoginInterceptor())
                //第一个*号是版本号，后续改版本号也不会影响
                //拦截的路径
                .addPathPatterns("/api/coupon/*/**", "/api/coupon_record/*/**")

                //增加不拦截的路径
                .excludePathPatterns("/api/coupon/*/page_coupon", "/api/coupon/*/new_user_coupon");
    }

}
